<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
            "http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<HEAD>



<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<META name="GENERATOR" content="hevea 1.08">
<LINK rel="stylesheet" type="text/css" href="umsroot.css">
<TITLE>
Events and Interrupts
</TITLE>
</HEAD>
<BODY >
<A HREF="umsroot066.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A>
<A HREF="index.html"><IMG SRC ="contents_motif.gif" ALT="Up"></A>
<A HREF="umsroot074.html"><IMG SRC ="next_motif.gif" ALT="Next"></A>
<HR>

<H1 CLASS="chapter"><A NAME="htoc171">Chapter&nbsp;13</A>&nbsp;&nbsp;Events and Interrupts</H1>

<A NAME="chapexcept"></A><BR>
<BR>
The normal execution of a Prolog program may be interrupted by
Events and Interrupts:
<DL CLASS="description" COMPACT=compact><DT CLASS="dt-description">
<B>Events</B><DD CLASS="dd-description"><BR>
<UL CLASS="itemize"><LI CLASS="li-itemize">
 they may occur asynchronously (posted by the environment)
 or synchronously (raised by the program itself).
 <LI CLASS="li-itemize">they are handled synchronously by a handler goal that is inserted
 into the resolvent.
 <LI CLASS="li-itemize">the handler can cause the interrupted execution to fail or to abort.
 <LI CLASS="li-itemize">the handler can interact with the interrupted execution only via
 nonlogical features (e.g. global variable or references).
 <LI CLASS="li-itemize">the handler can cause waking of delayed goals via symbolic triggers.
 </UL><BR>
<BR>
<DT CLASS="dt-description"><B>Errors</B><DD CLASS="dd-description"><BR>
Errors can be viewed as a special case of events. They are raised by
 built-in predicates (e.g. when the arguments are of the wrong type)
 and usually pass the culprit goal to the error handler.<BR>
<BR>
<DT CLASS="dt-description"><B>Interrupts</B><DD CLASS="dd-description"><BR>
Interrupts usually originate from the operating system, e.g. on a Unix
 host, signals are mapped to ECL<SUP><I>i</I></SUP>PS<SUP><I>e</I></SUP> interrupts.
 <UL CLASS="itemize"><LI CLASS="li-itemize">
 they occur asynchronously, but may be mapped into a sychronous event.
 <LI CLASS="li-itemize">certain predefined actions (like aborting) can be performed
 asynchronously
</UL>
</DL>
<UL>
<LI><A HREF="umsroot071.html">Events</A>
<UL>
<LI><A HREF="umsroot071.html#toc103">Event Identifiers and Event Handling</A>
<LI><A HREF="umsroot071.html#toc104">Raising Events</A>
<LI><A HREF="umsroot071.html#toc105">Events and Waking</A>
<LI><A HREF="umsroot071.html#toc106">Aborting an Execution with Events</A>
</UL>
<LI><A HREF="umsroot072.html">Errors</A>
<UL>
<LI><A HREF="umsroot072.html#toc107">Error Handlers</A>
<LI><A HREF="umsroot072.html#toc108">Arguments of Error Handlers</A>
<LI><A HREF="umsroot072.html#toc109">User Defined Errors</A>
</UL>
<LI><A HREF="umsroot073.html">Interrupts</A>
<UL>
<LI><A HREF="umsroot073.html#toc110">Interrupt Identifiers</A>
<LI><A HREF="umsroot073.html#toc111">Asynchronous handling</A>
</UL>
</UL>

<BR>
<BR>
<HR WIDTH="50%" SIZE=1><DL CLASS="list"><DT CLASS="dt-list"><A NAME="note19" HREF="umsroot071.html#text19"><FONT SIZE=5>1</FONT></A><DD CLASS="dd-list">This is time that the
CPU spends on executing user code, i.e. the ECL<SUP><I>i</I></SUP>PS<SUP><I>e</I></SUP> program.
<DT CLASS="dt-list"><A NAME="note20" HREF="umsroot071.html#text20"><FONT SIZE=5>2</FONT></A><DD CLASS="dd-list">Since implementing reliable timeouts is a
nontrivial task, we recommend the use of
<A HREF="../bips/lib/timeout/index.html"><B>lib(timeout)</B></A><A NAME="@default712"></A> for this purpose.
<DT CLASS="dt-list"><A NAME="note21" HREF="umsroot072.html#text21"><FONT SIZE=5>3</FONT></A><DD CLASS="dd-list">
This is necessary because the compiler recognises simple
predicates as deterministic at compile time and so if a
simple predicate would cause the invocation of a non-deterministic
error handler, the generated code may no longer be correct.
<DT CLASS="dt-list"><A NAME="note22" HREF="umsroot072.html#text22"><FONT SIZE=5>4</FONT></A><DD CLASS="dd-list">
Note that some events are not errors but are used for different purposes.
In thoses cases the second and third argument are sometimes used
differently. See Appendix <A HREF="umsroot147.html#chaperrors">C</A> for details.
</DL>
<HR>
<A HREF="umsroot066.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A>
<A HREF="index.html"><IMG SRC ="contents_motif.gif" ALT="Up"></A>
<A HREF="umsroot074.html"><IMG SRC ="next_motif.gif" ALT="Next"></A>
</BODY>
</HTML>
